#define _CRT_SECURE_NO_WARNINGS 1
int pivotIndex(int* nums, int numsSize) {
    int i = 0;
    int flag = 0;
    for (i = 0; i < numsSize; i++)
    {
        int left = 0;
        int l_sum = 0;
        int r_sum = 0;
        while (left < i)
        {
            l_sum += nums[left++];
        }
        int right = numsSize - 1;
        while (right > i)
        {
            r_sum += nums[right--];
        }
        if (l_sum == r_sum)
        {
            return i;
        }
    }
    return -1;
}